home *** CD-ROM | disk | FTP | other *** search
- Path: mudskipper.cac.psu.edu!user
- From: fcusack@tdx.org (frank.)
- Newsgroups: comp.lang.c++
- Subject: Re: static and dynamic classes in C++ ?
- Date: Thu, 14 Mar 1996 21:03:38 -0400
- Organization: Soylent Green is People!!
- Message-ID: <fcusack-1403962103390001@mudskipper.cac.psu.edu>
- References: <3148472F.41C6@informatik.uni-siegen.de>
- NNTP-Posting-Host: mudskipper.cac.psu.edu
-
- In article <3148472F.41C6@informatik.uni-siegen.de>, Runu Knips
- <plrunu@informatik.uni-siegen.de> wrote:
-
- > Hi people!
- >
- > 1. Is it possible to declare a class in a way that only
- > dynamic instances of it may be declared ?
-
- hmm... judging by question 2, I assume you mean "on the free store". There
- is a way to ensure that a class can only be constructed via the new
- operator. I am not sure what it is (so why did I post! :\ ) but my guess
- is that it is to make the constructor(s) private and overload the new
- operator.
-
- >
- > 2. Is it also possible to declare a class in a way that
- > only static (i.e. stack or data segment) instances may
- > be declared ?
-
- Overload the new operator and have it fail to construct a new object always.
-
- ~Frank
- -- I am Pentium of Borg. Division is futile. You will be approximated. --
- -- PGP ID: 1C0F6685 | NCB#56 | Visit me --> http://www.tdx.org/~fcusack/ --
-